// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   property_register_ok.java

package finance.config.report;

import include.nseer_db.nseer_db_backup1;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.ResultSet;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import javax.servlet.jsp.JspFactory;

public class property_register_ok extends HttpServlet
{

	ServletContext application;
	HttpSession session;

	public property_register_ok()
	{
	}

	public synchronized void service(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException
	{
		HttpSession dbSession = request.getSession();
		JspFactory _jspxFactory = JspFactory.getDefaultFactory();
		javax.servlet.jsp.PageContext pageContext = _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
		ServletContext dbApplication = dbSession.getServletContext();
		PrintWriter out = response.getWriter();
		nseer_db_backup1 finance_db = new nseer_db_backup1(dbApplication);
		try
		{
			if (finance_db.conn((String)dbSession.getAttribute("unit_db_name")))
			{
				String number_in_asset_table = request.getParameter("number_in_asset_table");
				String first_kind_name = request.getParameter("first_kind_name");
				String sqll = (new StringBuilder("select * from finance_config_report_itema where (number_in_asset_table='")).append(number_in_asset_table).append("' or first_kind_name='").append(first_kind_name).append("')").toString();
				ResultSet rs = finance_db.executeQuery(sqll);
				if (rs.next())
				{
					out.println("1");
				} else
				{
					String sql = (new StringBuilder("insert into finance_config_report_itema(number_in_asset_table,first_kind_name) values('")).append(number_in_asset_table).append("','").append(first_kind_name).append("')").toString();
					finance_db.executeUpdate(sql);
					out.println("0");
				}
				finance_db.commit();
				finance_db.close();
			} else
			{
				response.sendRedirect("error_conn.htm");
			}
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
	}
}
